// src.module.user.module.js

var basedao = require('./DB/mysqldb');
var db = basedao.Instance();
var User = db.define('t_user');

exports.queryByNameAndPwd = function(req, res, callback){
	var params = {'username':req.body.username, 'password':req.body.password};
	User.where(params, '', function(err, result){
		callback(err, result);
	});
};

exports.queryById = function (req, res, callback) {
	var params={};
	var uid = req.session.user.uid;
	params.name = 'u_id';
	params.value = req.query.u_id||uid;
	User.get(params, function(err, result){
		callback(err, result);
	});
};

exports.queryAllByPage = function (req, res, callback) {
	var params = req.query || req.params || "";
	User.queryPage(page, params, function(err, result){
		callback(err, result);
	});
};